package com.briup.recognition.web.controller;

import com.briup.recognition.bean.BaseFile;
import com.briup.recognition.service.IBaseFileService;
import com.briup.recognition.utils.Message;
import com.briup.recognition.utils.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: 黎海梅
 * @Date: 2021/03/28/19:58
 * @Description:
 */
@RestController
@RequestMapping("/baseFile")
public class BaseFileController {
    @Autowired
    private IBaseFileService baseFileService;

    @GetMapping("query")
    public Message query(){
        List<BaseFile> list = baseFileService.query();
        return MessageUtil.success(list);

    }

    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(BaseFile baseFile){
        baseFileService.saveOrUpdate(baseFile);
        return MessageUtil.success("操作成功");
    }

    @DeleteMapping("deleteById")
    public Message deleteById(String id){
        baseFileService.deleteById(id);
        return MessageUtil.success("删除成功");
    }

}
